1 using UnityEngine;
2 using
System.Collections.Generic;
3
4 public
class BigAnimals : MonoBehaviour {
5
6     
public GameObject[] animals;
7     
public void Start()
8     {
9         setAnimalIndex(Attr.currentAnimal);
10     }
11
12     
public void setAnimalIndex(int animalIndex)
13     {
14         setAllInvisible();
15         animals[animalIndex].SetActive(
true);
16         Attr.currentAnimal = animalIndex;
17     }
18
19     
private void setAllInvisible()
20     {
21         
for (int i = 0; i < animals.Length; i++)
22             animals[i].SetActive(
false);
23     }
24
25     
public GameObject getAnimalObject()
26     {
27         
return animals[Attr.currentAnimal];
28     }
29 }



Trò chơi đua xe động vật trong UNITY Engine 114.694 lượt xem

Gõ tìm kiếm nhanh...